home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls035c.1 / lib / vtcl / examples / short.tcl / short.tcl
Encoding:
Text File  |  1995-03-23  |  2.2 KB  |  72 lines

  1. #!/bin/vtcl
  2. # ---------------------------------------------------------------------
  3. # Copyright 1994 by SCO, Inc.
  4. # Permission to use, copy, modify, distribute, and sell this software
  5. # and its documentation for any purpose is hereby granted without fee,
  6. # provided that the above copyright notice appear in all copies and that
  7. # both that copyright  notice  and  this  permission  notice  appear  in
  8. # supporting documentation, and that the name  of  SCO  not  be used  in
  9. # advertising or publicity pertaining  to distribution of  the  software
  10. # without   specific,   written  prior   permission.    SCO   makes   no
  11. # representations  about  the  suitability  of  this  software  for  any
  12. # purpose.  It is provided "as is" without express or implied warranty.
  13. # ---------------------------------------------------------------------
  14.  
  15. # Demo        : short.tcl
  16. # Description    : Silly demo of how to use point help a la the
  17. #          -shortHelpCallback option.
  18. #  
  19.  
  20. # Close connection and exit Vtcl interpreter.
  21. proc CloseCB { cbs } {
  22.     VtClose; exit 0
  23. }
  24.  
  25. set pixDir /lib/vtcl/examples/pixmaps
  26. set pixList  [list check.px dir.px file.px newicon.px odir.px exec.px]
  27. set origExpressionsList [list oops! umph! uh-oh! "on no!" phooey! whoa! bummer!]
  28. set expressionsList $origExpressionsList  
  29.  
  30. proc SwitchPixMapCB {cbs} {
  31.     global pixList expressionsList origExpressionsList oopsLbl pixDir
  32.     set newPix [lvarpop pixList]
  33.     set widget [keylget cbs widget] 
  34.     VtSetValues $widget -pixmap $pixDir/$newPix
  35.     lvarpush pixList $newPix len
  36.     if { [llength $expressionsList] != 0 } {
  37.         VtSetValues $oopsLbl -label [lvarpop expressionsList]
  38.     } else {
  39.         # re-load
  40.         set expressionsList $origExpressionsList  
  41.     }
  42. }
  43.  
  44. set app [VtOpen joe]
  45. set mainForm [VtFormDialog $app.mainForm \
  46.     -title "Short Stuff" \
  47.     -ok \
  48.     -okCallback CloseCB \
  49.     ]
  50.  
  51. set lbl [VtLabel $mainForm.lbl \
  52.     -label "Put your mouse over\nan elusive pixmap!" \
  53.     ]
  54. set rowCol [VtRowColumn $mainForm.rowcol \
  55.     -topSide $lbl \
  56.     -numColumns 3 \
  57.     -vertical \
  58.     ]
  59. foreach item $pixList {
  60.     set itemName [lindex [split $item . ] 0 ]
  61.     VtLabel $rowCol.$itemName \
  62.         -pixmap $pixDir/$item  \
  63.         -shortHelpCallback SwitchPixMapCB 
  64. }
  65. set oopsLbl [VtLabel $mainForm.oops \
  66.     -topSide $rowCol \
  67.     -label "    " \
  68.     -xmArgs "background white" \
  69.     ]
  70. VtShow $mainForm
  71. VtMainLoop
  72.